package com.example.imitation_webchat_demo.thread;

import java.util.ArrayList;
import java.util.List;

import com.example.imitation_webchat_demo.event.FriendshipEvent;
import com.example.imitation_webchat_demo.model.Resource;
import com.example.imitation_webchat_demo.util.HttpClientUtils;

import de.greenrobot.event.EventBus;
import android.content.Context;
import android.util.Log;

//获取用户的好友信息的线程
public class FetchFriendshipRunnable implements Runnable {
	private List<String> list;
	private Context context;
	
	public FetchFriendshipRunnable(Context context, List<String> list){
		this.context = context;
		this.list = list;
	}
	
	@Override
	public void run() {
		List<String> paramNames  = new ArrayList<String>();
		paramNames.add("friends.userId_1");
		List<Object> paramValues = new ArrayList<Object>();
		paramValues.add(list.get(0));
		String result = HttpClientUtils.getResponseInfo(Resource.fetchFriendshipAction, paramNames, paramValues, context);
		
		FriendshipEvent event = new FriendshipEvent();
		event.setResult(result);
		EventBus.getDefault().post(event);
	}
}